Skip to content

Switch map generator webp library to avoid C compiler requirement - #4879

Merged
Celant merged 2 commits into
openfrontio:mainfrom
FeldrinH:map-generator-no-cgo
Aug 5, 2026
Merged

Celant merged 2 commits into
openfrontio:mainfrom
FeldrinH:map-generator-no-cgo

Conversation

@FeldrinH

@FeldrinH FeldrinH commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Resolves #4871

Description:

This replaces the webp encoder used in the map generator with one that does not require a C compiler to run. The errors in #4871 are what you get if you try to run the current map generator without a C compiler installed.

A small handful of thumbnails had minor differences when regenerated with the new encoder, presumably because of some minor difference in the encoder heuristics.

Please complete the following:

  • I have added screenshots for all UI updates
  • I process any text displayed to the user through translateText() and I've added it to the en.json file
  • I have added relevant tests to the test directory

Please put your Discord username so you can be contacted if a bug or regression is found:

feldrinh

@CLAassistant

CLAassistant commented Aug 5, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedgolang/​github.com/​gen2brain/​webp@​v0.6.4100100100100100

View full report

@coderabbitai

coderabbitai Bot commented Aug 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 74aea7db-835a-4016-88ec-99a2440efbb7

📥 Commits

Reviewing files that changed from the base of the PR and between d77e4a0 and 8e033b6.

⛔ Files ignored due to path filters (1)
  • map-generator/go.sum is excluded by !**/*.sum
📒 Files selected for processing (8)
  • map-generator/go.mod
  • map-generator/map_generator.go
  • resources/maps/balkans/thumbnail.webp
  • resources/maps/giantworldmap/thumbnail.webp
  • resources/maps/lasvegasstrip/thumbnail.webp
  • resources/maps/luna/thumbnail.webp
  • resources/maps/russia/thumbnail.webp
  • tests/testdata/maps/giantworldmap/thumbnail.webp

Walkthrough

This PR updates the map generator to use a different WebP package, changes thumbnail encoding to use buffered webp.Encode options, and reformats one processShore water-branch block without changing its behavior.

Changes

Map generator WebP update

Layer / File(s) Summary
WebP dependency and encoding path
map-generator/go.mod, map-generator/map_generator.go
The module replaces github.com/chai2010/webp with github.com/gen2brain/webp and adds indirect github.com/ebitengine/purego. The map generator import changes to the new package. convertToWebP now writes with webp.Encode into a bytes.Buffer and uses explicit Quality: 45 and Method: 4 options.
Shoreline branch formatting
map-generator/map_generator.go
The processShore water-branch condition and append logic are split across multiple lines. The branch behavior stays the same.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: celant, developingtom, evanpelle

Poem

A map tool changed its WebP song,
The old path left, the new moved on.
A buffer holds the image tight,
With quality set just right.
And shorelines flow in cleaner lines.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The shoreline detection reformat is unrelated to issue #4871, although it does not change behavior. Remove the unrelated shoreline formatting changes, or explain why they are required for the WebP encoder replacement.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states that the map generator WebP library changes to remove the C compiler requirement.
Description check ✅ Passed The description explains the WebP encoder replacement and directly relates it to the compilation issue.
Linked Issues check ✅ Passed The dependency and encoding changes directly address issue #4871 by replacing the failing WebP library with a non-C-dependent encoder.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the small-fix Small fix (≤ 50 lines) — auto-applied by PR gate label Aug 5, 2026
@Celant Celant added this to the Backlog milestone Aug 5, 2026
@Celant

Celant commented Aug 5, 2026

Copy link
Copy Markdown
Member

Thank you! I much prefer no CGO dependencies, and I think the difference of a few bytes between the images is probably fine.

@github-project-automation github-project-automation Bot moved this from Triage to Final Review in OpenFront Release Management Aug 5, 2026
@Celant
Celant merged commit 2bea916 into openfrontio:main Aug 5, 2026
12 of 13 checks passed
@github-project-automation github-project-automation Bot moved this from Final Review to Complete in OpenFront Release Management Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

small-fix Small fix (≤ 50 lines) — auto-applied by PR gate

Projects

Status: Complete

Development

Successfully merging this pull request may close these issues.

map-generator does not compile

3 participants